﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// OrgManager 的摘要描述
/// </summary>
public class OrgManager
{
	public OrgManager()
	{
		//
		// TODO: 在此加入建構函式的程式碼
		//
	}

    public string CurrentComp
    {
        get
        {
            HttpCookie c = HttpContext.Current.Request.Cookies["CurrentComp"];

            if (c == null)
            {
                return EmpManager.Current["CompID"];
            }

            return c.Value;
        }
        set
        {
            HttpCookie c = new HttpCookie("CurrentComp", value);
            HttpContext.Current.Response.Cookies.Add(c);

            HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.ToString());
        }
    }

    public static OrgManager Current
    {
        get
        {
            if (HttpContext.Current.Items["OrgManager"] == null)
            {
                HttpContext.Current.Items["OrgManager"] = new OrgManager();
            }

            return HttpContext.Current.Items["OrgManager"] as OrgManager;
        }
    }
}